<?php
	error_reporting(0);
    //require_once 'data/SessionControl.php';
    require_once 'data/handler.php';
    /*$session = new SessionControl();
    if(!$session->Check()){
        //unset($_SESSION['allow']);
        unset($_SESSION['fprint']);
        unset($_SESSION['salt_']);
    }*/
    session_start();
    if(!isset($_SESSION["isLoggedIn"]) || !($_SESSION["isLoggedIn"] === true)){
        session_unset();
        session_destroy();
        header('location: index.php');
    }
?>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Musique Basse</title>
        <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
        <link rel="stylesheet" type="text/css" href="css/stylesheet.css" />
        <script type="text/javascript" src="js/jquery.min.js"></script>
    </head>
    <body>
        <div id="main" class="page">
            <header>
                <h1><img src="buttons/logo.png"/></h1>
                <h6>A music store for all kinds of music listeners</h6>
                <nav>
                    <a href="index.php"><img src="buttons/home.png"/></a>
                    <a href="products.php"><img src="buttons/products.png"/></a>
                    <a href="account.php"><img src="buttons/account.png"/></a>
					<?php
                            if(isAdmin($_SESSION["uname"]))
                                echo ' <a href="admin.php"><img src="buttons/admincp.png"/></a>';
					?>
					<a href="cart.php"><img src="buttons/Cart.png"/></a>
                    <a href="logout.php" class="fltright"><img src="buttons/logout.png"/></a>
                </nav>
            </header>
            
            <div id="content">
                <h5>Account Details</h5>
                <hr>
                <?php
                    $data = getInfo($_SESSION['uname']);
                    if(array_key_exists('error', $data))
                        echo 'Error: '.$data['error'].'<br>';
                    else{
                ?>
                    <form id="editform" name="editform" action="" method="post">
                        <ul>
                            <li>
                                <label for="fname">First Name</label><em>*</em>
                                <input type="text" id="fname" name="fname" value="<?php echo $data['firstname'];?>" />
                            </li>
                            <li>
                                <label for="lname">Last Name</label><em>*</em>
                                <input type="text" id="lname" name="lname" value="<?php echo $data['lastname'];?>" />
                            </li>
                            <li>
                                <label for="address">Address</label><em>*</em>
                                <textarea id="address" name="address"><?php echo $data['address'];?></textarea>
                            </li>
                            <li>
                                <label for="emailreg">E-mail</label><em>*</em>
                                <input type="text" id="emailreg" name="emailreg" value="<?php echo $data['email'];?>" />
                            </li>
                            <li>
                                <label for="password1">Password</label><em>*</em>
                                <input type="password" value="aaaaaaaaa" disabled />
                            </li>
                            <li>
                                <input type="checkbox" id="chpwd" name="chpwd" />
                                <label for="chpwd">Change Password</label>
                                <ul>
                                    <li>
                                        <label for="password1">Old Password</label><em>*</em>
                                        <input type="password" id="password1" name="password1" disabled />
                                    </li>
                                    <li>
                                        <label for="password2">New Password</label><em>*</em>
                                        <input type="password" id="password2" name="password2" disabled />
                                    </li>
                                </ul>
                            </li>
                            <li>
                                <input type="submit" id="submitedit" name="submitedit" value="Edit Account" />
                            </li>
                        </ul>
                    </form>
                <?php }?>
            </div>
            
            <div class="clear"></div>
            
            <footer>
                <p>Copyright &copy; 2012 KENNICS. All rights reserved.</p>
                <p>Design by Werdnazner</p>
            </footer>
        </div>
    </body>
</html>
